cmake_minimum_required(VERSION 3.16)

project(MPlayer LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# UTF-8 Support
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")

# Package Import
find_package(Qt5 ${QT_VERSION}
    COMPONENTS
        Core
        Widgets
        OpenGL
        Quick
        Multimedia
    REQUIRED
)

# Add Source Code
add_subdirectory(libs)
add_subdirectory(src)

# Add .qrc
set(M_RESOURCES
    src/UI.qrc
    src/Resources.qrc
)

# Set QML import path for Qt Creator
set(QML_IMPORT_PATH
    src/UI
)

# Add Main Executable
add_executable(MPlayer ${M_RESOURCES})

# Link Libraries
target_link_libraries(MPlayer PRIVATE MPlayerLibs)

# Install Option
include(GNUInstallDirs)
install(TARGETS MPlayer
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
